

package com.scuec.tourismwebsite.service;

import com.scuec.tourismwebsite.entity.Message;
import com.scuec.tourismwebsite.mapper.MessageMapper;
import com.scuec.tourismwebsite.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    private MessageMapper messageMapper;

    @Override
    public List<Message> getAllMessages() {
        return messageMapper.findAll();
    }

    @Override
    public void addMessage(String content) {
        Message message = new Message();
        message.setContent(content);
        messageMapper.insert(message);
    }
}